package day05;

import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class ArrayDemo {
    public static void main(String[] args) {
       /* int[] arr=new int[3];
        Scanner sc=new Scanner(System.in);
        for(int i=0;i<arr.length;i++){
            arr[i]=(int)(Math.random()*100);
        }
        System.out.println("请问您要查询第几个位置的值");

        int a=sc.nextInt();
        System.out.println(arr[a-1]);

        Random r=new Random(100);

        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        sc.nextInt();*/

        int[] arr = {10,20,30,40,50};

        int[] b = Arrays.copyOf(arr, arr.length);

        arr =Arrays.copyOf(arr , arr.length+3);

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
        System.out.println();

        int[] c=Arrays.copyOf(arr,6);

        for (int i = 0; i < c.length; i++) {
            System.out.print(c[i]+" ");
        }
        System.out.println();


        int[] d=Arrays.copyOf(c,8);
        for (int i=0;i<d.length;i++){
            System.out.print(d[i]+" ");
        }
        System.out.println();


    }
}
